import org.omg.CORBA.INTERNAL;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Test2 {
    public static void main(String[] args) {
        Solution.addElement(3);
        Solution.addElement(2);
        Solution.addElement(1);
        Solution.addElement(2);
        Solution.addElement(8);
        Solution.addElement(5);
        Solution.addElement(15);

    }
}

class Solution {
    private static List<Integer> sSorted = new LinkedList<>();
    public static void addElement(int e) {
        if (sSorted.isEmpty()) {
            sSorted.add(e);
        } else {
            boolean b = true;
            for (int i=0;i<sSorted.size();i++) {
                if (e < sSorted.get(i)) {
                    b = false;
                    sSorted.add(i, e);
                    break;
                }
            }
            if (b) {
                sSorted.add(e);
            }
        }

        System.out.println("----------------");
        for (Integer s : sSorted) {
            System.out.println(s);
        }

    }
}
